package com.mini.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 发送状态
 */
public enum SendStatus {

    CREATE("0", "创建"), SUCCESS("1", "成功"), FAIL("2", "失败");

    @EnumValue
    @JsonValue
    private final String code;
    private final String info;

    SendStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static SendStatus getBy(String code) {
        return EnumUtil.getBy(SendStatus::getCode, code);
    }
}
